<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <title>添加旅行社</title>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <style>
        body { background: #f8f9fb; font-family: 'Microsoft YaHei', Arial, sans-serif; }
        .container { max-width: 500px; margin: 60px auto; background: #fff; border-radius: 18px; box-shadow: 0 2px 16px rgba(0,0,0,0.08); padding: 40px 36px; }
        .form-wrap { width: 100%; }
        h2 { text-align: center; font-size: 32px; margin-bottom: 32px; font-weight: bold; letter-spacing: 2px; }
        .form-row { margin-bottom: 22px; display: flex; align-items: center; }
        .form-row label { width: 90px; color: #333; font-size: 16px; }
        .form-row input, .form-row textarea {
            flex: 1; padding: 10px 14px; border: 1px solid #e6e6e6; border-radius: 8px; font-size: 16px; background: #f6f8fa;
        }
        .form-row textarea { resize: vertical; min-height: 60px; }
        .form-actions { display: flex; justify-content: space-between; margin-top: 30px; }
        .form-actions button { min-width: 100px; padding: 10px 0; font-size: 18px; border-radius: 8px; border: none; cursor: pointer; }
        .form-actions .submit-btn { background: #1890ff; color: #fff; }
        .form-actions .reset-btn { background: #fff; color: #1890ff; border: 1px solid #1890ff; }
        .form-actions .back-btn { background: #bdbdbd; color: #fff; }
        .form-actions .submit-btn:hover { background: #40a9ff; }
        .form-actions .reset-btn:hover { background: #e6f7ff; }
        .form-actions .back-btn:hover { background: #888; }
    </style>
</head>
<body>
<div class="container">
    <div class="form-wrap">
        <h2>添加旅行社</h2>
        <form id="routeForm" autocomplete="off">
            <div class="form-row">
                <label for="name">名称</label>
                <input type="text" id="name" name="name" required placeholder="请输入旅行社名称">
            </div>
            <div class="form-row">
                <label for="description">描述</label>
                <textarea id="description" name="description" placeholder="请输入描述"></textarea>
            </div>
            <div class="form-actions">
                <button type="submit" class="submit-btn">提交</button>
                <button type="reset" class="reset-btn">重置</button>
                <button type="button" class="back-btn" onclick="window.location.href='manage.html'">返回列表</button>
            </div>
        </form>
    </div>
</div>
<script>
document.getElementById('routeForm').onsubmit = function(e) {
    e.preventDefault();
    var route = {
        name: document.getElementById('name').value.trim(),
        description: document.getElementById('description').value.trim()
    };
    fetch('/api/route', {
        method: 'POST',
        headers: { 'Content-Type': 'application/json' },
        body: JSON.stringify(route)
    })
    .then(response => response.json())
    .then(data => {
        if (data.success) {
            alert('添加成功');
            window.location.href = 'manage.html';
        } else {
            alert(data.message || '添加失败');
        }
    });
};
</script>
</body>
</html> 